﻿
@inject IHttpService _httpService


<div>
    @if (isReady)
    {
        @if (Model.Count == 0)
        {
            <NotFoundCard Fill/>
        }
        @foreach (var item in Model)
        {
            <div class="mb-3">
                <CnGalWebSite.Shared.MasaComponent.PC.Peripheries.PeripheryOverViewTip Model="item" OnlyShowContext/>
            </div>
        }
    }
</div>



@code {
    [Parameter]
    public string UserId { get; set; }

    public List<GameOverviewPeripheryListModel> Model { get; set; }

    bool isReady = false;
    [CascadingParameter]
    public ErrorHandler ErrorHandler { get; set; }

    protected override async Task OnInitializedAsync()
    {

        try
        {
            Model = await _httpService.GetAsync<List<GameOverviewPeripheryListModel>>("api/peripheries/GetUserOverviewPeripheries/" + UserId);
            isReady = true;
        }
        catch(Exception ex)
        {
            await ErrorHandler.ProcessError(ex, "获取用户相关周边集合列表失败");
        }
    }
}
